package cn.stylefeng.guns.modular.order.service;

import cn.hutool.json.JSONObject;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.basic.entity.BasicCustomer;
import cn.stylefeng.guns.modular.order.entity.OutOrder;
import cn.stylefeng.guns.modular.order.entity.OutOrderExcelItem;
import cn.stylefeng.guns.modular.order.model.params.OutOrderParam;
import cn.stylefeng.guns.modular.order.model.result.OutOrderResult;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;

/**
 * 出库订单表 服务类
 */
public interface OutOrderService extends IService<OutOrder> {

    /**
     * 新增
     *
     * @author hu
     * @Date 2019-07-08
     */
    void add(OutOrderParam param);

    /**
     * 删除
     *
     * @author hu
     * @Date 2019-07-08
     */
    void delete(OutOrderParam param);

    /**
     * 更新
     *
     * @author hu
     * @Date 2019-07-08
     */
    void update(OutOrderParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author hu
     * @Date 2019-07-08
     */
    OutOrderResult findBySpec(OutOrderParam param,Long operateId);

    /**
     * 查询列表，Specification模式
     *
     * @author hu
     * @Date 2019-07-08
     */
    List<OutOrderResult> findListBySpec(OutOrderParam param, Long operateId);

    /**
     * 查询分页数据，Specification模式
     *
     * @author hu
     * @Date 2019-07-08
     */
     LayuiPageInfo findPageBySpec(OutOrderParam param, String condition, Long operateId);

	List<OutOrderResult> dtjOrderNumberList(OutOrderParam param, Long operateId);

    OutOrder findByTheLastOne();

    /**
     * 处理出库导入数据
     * @param putExcelList
     * @param outOrderParam
     * @param data
     */
    ResponseData excelAdd(List<OutOrderExcelItem> putExcelList, OutOrderParam outOrderParam, ResponseData data);



    /**
     * 查询单条数据，Specification模式
     *
     * @author hu
     * @Date 2019-07-08
     */
    OutOrderResult findbyoutOrderNumber(String  outOrderNumber);
    OutOrderResult findbyoutOrderNumberByDeptId(String  customerNumber,String  outOrderNumber,Long deptId);

    /**
     * 出库订单打印 
     * 查询收货单位
     * @param outOrderParam
     * @param condition
     * @return
     */
	LayuiPageInfo getUnitlistPage(OutOrderParam outOrderParam, String condition,Long operateId);

	LayuiPageInfo QuerylistPageBySpec(OutOrderParam outOrderParam, String condition,Long operateId);

	LayuiPageInfo ConfirmlistPageBySpec(OutOrderParam outOrderParam, String condition,Long operateId);

	/**
	 * 批量保存list
	 * @param List<OutOrderParam>
	 */
	boolean saveBatchList(List<OutOrderParam> list);

	ResponseData getExceldata(MultipartFile file, OutOrderParam outOrderParam, ResponseData data) throws Exception;

	ResponseData getExceldata_ha(MultipartFile file, OutOrderParam outOrderParam, ResponseData data) throws Exception;

	/**
	 * 撤回出库订单
	 * 
	 */
	ResponseData revokeS(OutOrder outOrder, ResponseData data);
	ResponseData revoketool(OutOrder outOrder, ResponseData data);

	Integer outOrderCount(OutOrderParam outOrderParam, Long warehouseId);

	Integer outNewOrderCount(OutOrderParam outOrderParam, Long warehouseId);

	Integer outWeiwanchengOrderCount(OutOrderParam outOrderParam, Long warehouseId);

	Integer outYuqiOrderCount(OutOrderParam outOrderParam, Long warehouseId);

	Integer outZuofeiOrderCount(OutOrderParam outOrderParam, Long warehouseId);

	LayuiPageInfo PrintlistPageBySpec(OutOrderParam outOrderParam, String condition,Long operateId);

	OutOrderResult getPrintstorageOut(OutOrderParam outOrderParam);

	/**
	 * 不原路返回库存，直接添加库存
	 * @param outOrder
	 * @param data
	 * @return
	 */
	ResponseData revokeStrides(OutOrder outOrder, ResponseData data);

	/**
	 * 直接扣除库存，不进行拣货
	 * @param outOrder
	 * @return
	 */
	ResponseData outStridesUpdateStorageStock(OutOrder outOrder);

	void updateBySpec(OutOrderParam outOrderParam);

	Workbook exportToExcel(OutOrderParam outOrderParam);


	/**
	 * 聚水潭出库单
	 */
	ResponseData saveJstOutOrder(JSONObject data , User user, BasicCustomer byId);

	Integer insertOutOrder(OutOrderParam outOrderParam);

    ResponseData getExceldataLY(MultipartFile file, OutOrderParam outOrderParam, ResponseData data) throws Exception;

}
